//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.great.medical.common;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import java.io.Serializable;
import java.util.Map;

public class PageParams extends Page implements Serializable {
    private static final long serialVersionUID = -1710273706052960025L;
    private int page;
    private int limit;
    private String sort;
    private String order;
    private Map<String, Object> requestMap;

    public PageParams() {
        this.page = 1;
        this.limit = 20;
        this.requestMap = Maps.newHashMap();
        this.requestMap = Maps.newHashMap();
    }

    public PageParams(Map map) {
        this.page = 1;
        this.limit = 20;
        this.requestMap = Maps.newHashMap();
        if (map == null) {
            map = Maps.newHashMap();
        }

        this.page = Integer.parseInt(((Map)map).getOrDefault("page", 1).toString());
        this.limit = Integer.parseInt(((Map)map).getOrDefault("limit", 20).toString());
        this.sort = (String)((Map)map).getOrDefault("sort", "");
        this.order = (String)((Map)map).getOrDefault("order", "");
        super.setCurrent((long)this.page);
        super.setSize((long)this.limit);
        ((Map)map).remove("page");
        ((Map)map).remove("limit");
        ((Map)map).remove("sort");
        ((Map)map).remove("order");
        this.requestMap.putAll((Map)map);
    }

    public PageParams(int page, int limit) {
        this(page, limit, "", "");
    }

    public PageParams(int page, int limit, String sort, String order) {
        this.page = 1;
        this.limit = 20;
        this.requestMap = Maps.newHashMap();
        this.page = page;
        this.limit = limit;
        this.sort = sort;
        this.order = order;
        super.setCurrent((long)page);
        super.setSize((long)limit);
    }

    public int getPage() {
        if (this.page <= 0) {
            this.page = 1;
        }

        return this.page;
    }

    public void setPage(int page) {
        this.page = page;
        super.setCurrent((long)page);
    }

    public int getLimit() {
        if (this.limit > 999) {
            this.limit = 999;
        }

        return this.limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
        super.setSize((long)limit);
    }

    public String getSort() {
        return this.sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getOrder() {
        return this.order;
    }

    public void setOrder(String order) {
        this.order = order;
    }


    public void setOrderBy(String orderBy) {
    }


    public Map<String, Object> getRequestMap() {
        return this.requestMap;
    }

    public void setRequestMap(Map<String, Object> requestMap) {
        this.requestMap = requestMap;
    }
}
